package com.demo;

import com.demo.controller.StudentController;
import com.demo.controller.UserAdviceController;
import com.demo.model.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
        //User user=(User)context.getBean("user");
//        User user=context.getBean(User.class);
//        System.out.println(user.sayHi());

        //User user=context.getBean("user", User.class);//根据 Bean名称和 Bean类型获取 Bean（排除将 null强转为 User的情况）
//        ArticleController articleController = context.getBean("articleController", ArticleController.class);
//        System.out.println(articleController.sayHello());
//        System.out.println(articleController.num());

//        BController bController = context.getBean("bController", BController.class);
//        System.out.println(bController.sayHi());

//        Student student = context.getBean("s2", Student.class );
//        System.out.println(student);

//        StudentController studentController = context.getBean("studentController", StudentController.class);
//        studentController.getStudent();

//        UserAdviceController userAdviceController = context.getBean("userAdviceController", UserAdviceController.class);
//        userAdviceController.getStudent();

//        studentController.sayHi();
    }
}
